<%--
 *  File:    DaySellsAnalysisReport.jsp
 *  @Author: JackWang
 *  Date:    2012.11.15

 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ page import="java.text.*" %>
<%
Category cat = Category.getInstance("jsp.DaySellsAnalysisReport");
String strModuleName = "COM";
String privilegeCode = "R30060";
String strTableName = "v_bifactofdayess";
String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>
<%@ include file="/rpt/ReportURL.inc" %>
<html>
<head>
<title>MonthSalesDataSummary</title>
<PageFlow:CheckPageFlow pageName="p_bifactofdayess"/>
<%
Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
if(searchresults == null) searchresults = new Vector();

HashMap userinfo = (HashMap)session.getAttribute("userinfo");
Integer  issalesman = (Integer) userinfo.get("issalesman");
String flag = (String)pageContext.getAttribute("flag");
java.util.Calendar cal = java.util.Calendar.getInstance();      
int day = cal.get(Calendar.DAY_OF_MONTH);
String dateFormat = (String)session.getAttribute("dateformat");
if(dateFormat==null)dateFormat = "yyyy-MM-dd";


%>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/Calendar.js"></script>
<%@ include file ="/inc/NewCalendar.inc" %>
<script language="JavaScript">
//xuanze
function popDealer() {
	  opt = "dealer";
	  var status = "height=450, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
			var url = "PathOrgSelect.jsp?o_thread=" + Math.random();
			url += "&globalpccode=112,113,114,117";
			if (typeof popwindow != 'undefined') popwindow.close();
			popwindow = window.open(url, "newwindow", status);
	}
	
	function popCustomer() {
	  opt = "customer";
	  var status = "height=450, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
			var url = "PathOrgSelect.jsp?o_thread=" + Math.random();
			url += "&globalpccode=99,112,117";
			
			if (typeof popwindow != 'undefined') popwindow.close();
			popwindow = window.open(url, "newwindow", status);
	}
	function page_setOrg(id, name, code) {
	  if(opt == "dealer"){
	  	cform.orgid.value=id;
	  	cform.orgcode.value = code;
	  	cform.orgname.value = name;
	  }
	  if(opt == "customer"){
	  	cform.customerid.value=id;
	  	cform.customercode.value = code;
	  	cform.customername.value = name;
	  }	
	  opt = "";
	  if (popwindow != null)
	    popwindow.close();
	}


//salesman
function popRep() {
	var regionid=cform.regionid.value;
	var proviceofficecode = cform.proviceofficelist.value;
	var businessareacode = cform.businessarealist.value;
	//alert(regionid+"|"+proviceofficecode+"|"+businessareacode+"|");
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "<%=contextPath%>/tdr/dataverify/SalesPopWindow.jsp?<%= OvalTools.randomURL() %>&regionid="+regionid+"&proviceofficecode="+proviceofficecode+"&businessareacode="+businessareacode;
	popwindow = window.open(url, "newwindow", status);
  }

function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}


function page_actionfun(){
if(isNullChecked(cform.historyofmonthsalesid)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
  if(!confirm("<%=message.getMessageDesc("ZYL_TDR_YESPASS")%>"))return;
  cform.actionname.value = "checkpass";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
		
}

//getbusinessarea
function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.getResultFromVector("resultproviceoffice","proviceofficename","proviceofficecode","cform.proviceofficelist");
	datahandler.add_job("j_yorndealersummary");
	datahandler.runDataHandler();
  }
  
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "DaySellsAnalysisReport.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_excel(){

	var id = document.cform.userid.value;	
	var year =document.cform.years.value;
	var month =document.cform.months.value;
	<%if(issalesman == new Integer(1)){%>
	var proviceofficecode = document.cform.proviceofficelist.value;
	var businessareacode = document.cform.businessarealist.value;
	var userids =document.cform.userids.value;
	var regionid= document.cform.regionid.value;
 	 window.location.href = "<%= reportURL %>/servlet/ExcecuteReport/DoctorRecipelData.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&parentareaid="+regionid+"&areacode="+proviceofficecode+"&=areacode1="+businessareacode+"&employeeids="+userids+"&year="+year+"&month="+month;	
	<% }else{  %>
	var salesman =document.cform.userid.value;
 		 window.location.href = "<%= reportURL %>/servlet/ExcecuteReport/DoctorRecipelData.sox?__folder=/ovalreport&rownum=2&employeeid="+ id+"&year="+year+"&month="+month+"&salesman="+salesman;	
 	<% }%>
 }

function page_getbusinessarea(){
	var regionid = cform.regionid.value;
	var objdeptcode = eval("cform.proviceofficelist");
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , regionid, "Integer");
	datahandler.add_params("proviceofficelist" , objdeptcode.value , "String");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","cform.businessarealist");
	datahandler.add_job("j_yorndealersummary");
	datahandler.runDataHandler();
}
function page_selectProvince()
{
  if(popwindow!=null)
    popwindow.close();
    popwindow = window.open('<%=contextPath %>/masterdata/ogm/RegionSelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN','newwindow', 'height=250, width=500,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}
function page_setRegion(code,name)
{
  if(code != document.cform.regioncode.value)
  {
    document.cform.citycode.value = "";
    document.cform.cityname.value = "";
  }
  document.cform.regioncode.value = code;
  document.cform.regionname.value = name;
  if (popwindow != null)
    popwindow.close();
}

function page_selectCity(flag,grade)
{
  var regioncode = document.cform.regioncode.value;
  var parentcitycode = document.cform.citycode.value;
  if(flag=="city")parentcitycode='null';
  /*if(regioncode=="" || regioncode==-1){
    alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_Province"))%>");
    return;
  }
  if(parentcitycode=="" || parentcitycode==-1){
    alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_City"))%>");
    return;
  }*/
  var url='<%=contextPath %>/masterdata/ogm/CitySelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN&regioncode=' + regioncode + '&flag=' + flag+'&grade='+grade;
  if(flag=="county"){
   url=url+'&parentcitycode='+parentcitycode;
  }
  if(popwindow!=null)
    popwindow.close();
    popwindow = window.open(url,'newwindow', 'height=250, width=400,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
}

function page_setCity(code,name,id,flag)
{
	if(flag == "county"){
		document.cform.countycode.value = code;
		document.cform.countyname.value = name;
	}else {
	    document.cform.cityid.value = id;
		document.cform.citycode.value = code;
		document.cform.cityname.value = name;
	}
  if (popwindow != null)
      popwindow.close();
}

function page_allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('bifactofdayessid');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			if(!alldatafile[i].disabled)
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i <= length;i++){
			alldatafile[i].checked = false;
		}	
	}
}

function popBusinessarea(){
	if(popwindow!=null) popwindow.close();
    url = '<%=contextPath %>/phap/masterdata/erm/BusinessAreaPop.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=500, width=250,top=100,left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
function setBusinessarea(id,areaname){
	document.cform['businessareaid'].value=id;
	document.cform['areaname'].value=areaname;
}

function page_selectProd() {
		var url = "<%=contextPath%>/phap/phap.datp/masterdata/kdm/ProductSelect.jsp?o_thread=" + Math.random();
		if (typeof popwindow != 'undefined') popwindow.close();
		popwindow = window.open(url, "newwindow", status);
	}
function page_setproduct(id,umcode,prodcode,prodname){
		document.cform.itemid.value=id;
		document.cform.prodname.value=prodname;
		document.cform.prodcode.value=prodcode;
}
function page_selectUser(flag) {
    document.getElementById("flag").value=flag;
	var status = "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
	var url = "<%=contextPath%>/img/UserSelectPop.jsp?o_thread=" + Math.random();
		
	if (typeof popwindow != 'undefined') popwindow.close();
	popwindow = window.open(url, "newwindow", status);
}
function page_setUser(id,code,name){
    var flag=document.getElementById("flag").value;
	if (flag == 1){
	document.getElementById("salesrepid").value=id;
	document.getElementById("username").value=code;
	document.getElementById("employeename").value=name;
	}else{
	document.getElementById("parentuserid").value=id;
	document.getElementById("parentusername").value=code;
	document.getElementById("parentemployeename").value=name;
	}
}

function page_info(orgid,itemid,date,areacode,flag)
{   
    //var areaids=document.cform.areaids.value;
    if ( flag == "pur" ){
     popwindow = window.open('DayPurAnalysisDetail.jsp?<%= OvalTools.randomURL() %>&orgid='+orgid+'&itemid='+itemid+'&purchasedate='+date+'&areaids='+areacode,'newwindow', 'height=400, width=1200,top=200,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
    }
    if ( flag == "inv" ){
     popwindow = window.open('DayInvAnalysisDetail.jsp?<%= OvalTools.randomURL() %>&orgid='+orgid+'&itemid='+itemid+'&inventorydate='+date+'&areaids='+areacode,'newwindow', 'height=400, width=1200,top=200,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
    }  
    if ( flag == "sal" ){
     popwindow = window.open('DaySalAnalysisDetail.jsp?<%= OvalTools.randomURL() %>&orgid='+orgid+'&itemid='+itemid+'&salsedate='+date+'&areaids='+areacode,'newwindow', 'height=400, width=1200,top=200,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
    } 
}

function page_clear(){
  document.cform.regioncode.value = "";
  document.cform.regionname.value = "";
  document.cform.regionid.value = "";
  document.cform.citycode.value = "";
  document.cform.cityname.value = "";
  document.cform.cityid.value = "";
  document.cform.orgid.value = "";
  document.cform.orgname.value = "";
  document.cform.orgcode.value = "";
   <% SimpleDateFormat formatter2 = new SimpleDateFormat ("yyyy-MM-dd");%>
  document.cform.enddate.value = "<%=formatter2.format(new Date()) %>";
  document.cform.startdate.value = "<%=formatter2.format(new Date()) %>";
  
  /*
  document.cform.businessareaid.value = "";
  document.cform.areaname.value = "";
  */
  document.cform.itemid.value = "";
  document.cform.prodname.value = "";
  document.cform.salesrepid.value = "";
  
  document.cform.username.value = "";
  document.cform.employeename.value = "";
  document.cform.parentuserid.value = "";
  document.cform.parentusername.value = "";
  document.cform.parentemployeename.value = "";
  
  document.cform.areaids.value = "";
  document.cform.businessareanames.value = "";
	
}
function popBusinessarea_moulty(){
	if(popwindow!=null) popwindow.close();
	
    url = '<%=contextPath %>/zyl/masterdata/map/SelectAreaTree.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=540, width=250,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}
function setAreas(areaids,areanames,areacodes){

	document.cform.areaids.value = areaids;
	document.cform.businessareanames.value = areanames;
	//document.cform.businessareacode.value = areacodes;
} 
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="overflow: auto">
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
  <input type="hidden" name="pagename" value="p_bifactofdayess">
  <input type="hidden" name="flag" >
  <input type="hidden" name="actionname">
  <custom:hidden property="userid" name="userinfo" scope="session"></custom:hidden>
  <input type="hidden" name="isfirst" value="N"/>
<%@ include file="/inc/PageLocation.inc" %>
<table width="150%" cellspacing="0" border="0" cellpadding="0">
  <tr>
    <td>
      <table width="1400" border="0" cellspacing="0" >
		<tr>
	        <td><%= label.getLabelName("L_Province") + label.getLabelName("L_Colon") %></td>
	        <td>
	            <custom:text property="regioncode"   size="10" readonly="true"/>
                 <a onclick="javascript:page_selectProvince();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
                <custom:text property="regionname" size="10"/>
                <custom:hidden property="regionid" />
	        </td>
	        <td><%= label.getLabelName("L_City") + label.getLabelName("L_Colon") %></td>
			<td>
			    <custom:text property="citycode"   size="10" readonly="true"/>
            	<a onclick="javascript:page_selectCity('city',1);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
            	<custom:text property="cityname" readonly="true" size="10"/>
            	<custom:hidden property="cityid" />
            </td>
	        <td><%= label.getLabelName("L_CustomerName") + label.getLabelName("L_Colon") %></td>
	        <td>
	            <custom:text property="orgcode" size="10" readonly="true"/>
	            <a onclick="javascript:popDealer();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
	            <custom:text property="orgname" readonly="true" size="30"/>
	            <custom:hidden property="orgid" />
	        </td>

	          <%
                SimpleDateFormat formatter1 = new SimpleDateFormat ("yyyy-MM-dd");
                String str_date_end=formatter1.format(new Date());
                
              %>
	        <td><%= label.getLabelName("L_TimePeriod") + label.getLabelName("L_Colon") %></td>
	        <td>
	        <%if(request.getParameter("isfirst")==null){%>
                <custom:text property="startdate"  dataType="date"  module="IMG" size="15" name="onehash"/><a onclick="javascript:c.show(this,'cform.startdate','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
             <%}else{
            	   String startdate =request.getParameter("startdate");
	               if(startdate==null) startdate="";
               %> 
                <custom:text property="startdate"  dataType="date"  module="IMG" size="15" value="<%=startdate %>" /><a onclick="javascript:c.show(this,'cform.startdate','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
             <%}%>
              <!--  <a onclick="javascript:c.show(this,'cform.startdate','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>-->
              --
              <%if(request.getParameter("enddate")==null){%>
			  <custom:text property="enddate" dataType="date" dataFormatName="dateformat"  size="15" value="<%=str_date_end %>"/><a onclick="javascript:c.show(this,'cform.enddate','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
			  <%}else{
				   String enddate =request.getParameter("enddate");
	               if(enddate==null) enddate="";
			  %>
			  <custom:text property="enddate"  dataType="date" dataFormatName="dateformat"  size="15" value="<%=enddate %>"/><a onclick="javascript:c.show(this,'cform.enddate','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
			  <%}%>
         </td>
		</tr>
		<tr>
		 <!--  <td><%= label.getLabelName("L_CBusinessArea") + label.getLabelName("L_Colon") %></td>
		 <td>
	        <custom:hidden property="businessareaid"  />
			<custom:text property="areaname" readonly="true" />
			<a onclick="popBusinessarea()"><custom:button type="3" value="*"/></a>
		 </td>
		 -->
		 <td  class="td_right"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
			    <td style="width:160px;" class="td_left"> <custom:hidden  property="areaids" />
					<custom:text  property="businessareanames"  label="L_BusinessAreaName" readonly="true"/>
					<a onclick="popBusinessarea_moulty()"><custom:button type="3" value="*"/></a>	
		        </td>
		 <td ><%= label.getLabelName("L_Product")+ label.getLabelName("L_Colon") %></td>
		 <td><custom:text property="prodname" readonly="false" size="22" /> 
		 <a onclick="javascript:page_selectProd();">
		 <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a>
		  <custom:hidden property="itemid" /> <custom:hidden property="prodcode" />
		 </td>
	     <td><%= label.getLabelName("L_Director") + label.getLabelName("L_Colon") %></td>
	     <td><!--<custom:text property="regionname"/>-->
			<custom:text property="username" size="10"  />
		    <a onclick="javascript:page_selectUser(1);">
		    <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a> 
			<custom:text property="employeename" size="10" readonly="true" /> 
			<custom:hidden property="salesrepid"/>
		 </td>
		</tr>
		<tr>
		 <td><%= label.getLabelName("L_ParentManager") + label.getLabelName("L_Colon") %></td>
		 <td>
	        <custom:text property="parentusername" size="10"  />
		    <a onclick="javascript:page_selectUser(2);">
		    <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a> 
			<custom:text property="parentemployeename" size="10" readonly="true" /> 
			<custom:hidden property="parentuserid"/>
		 </td>
		 <td>
		    &nbsp;&nbsp;&nbsp;<a href="javascript:page_summary('search')"><img src="<%= contextPath %>/images/<%= strLanguageCode %>/go_fy.gif" border="0" style="border: 1 solid #000000"></a>
            <button type="button" onclick="page_clear()" class="button1" name="re" value="clear" style="width:60"><%=label.getLabelName("L_Clear") %></button>
		 </td>
		</tr>
	  </table>
    </td>
  </tr>
    <tr>
        <td>
<div style=" overflow:scroll">
  <table width="100%" border="1" cellpadding="0"
			bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0"
			align="center">
			<tr class="deepblue-left">
				<td class="title_center"><%= label.getLabelName("L_CustomerRegion")%></td>
            	<td class="title_center"><%= label.getLabelName("L_CustomerCity")%></td>
				<td class="title_center"><%= label.getLabelName("L_CBusinessArea") %></td>
				<td class="title_center"><%= label.getLabelName("L_ParentManagerName") %></td>
				<td class="title_center"><%= label.getLabelName("L_CustomerUsr") %></td>
				<td class="title_center"><%= label.getLabelName("L_CustomerCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_CustomerName") %></td>
				<td class="title_center"><%= label.getLabelName("L_CUSTOMTYPE") %></td>
				<td class="title_center"><%= label.getLabelName("L_Chain") %></td>
				<td class="title_center"><%= label.getLabelName("L_IsLocked") %></td>
				<td class="title_center"><%= label.getLabelName("L_YesOrNoTarget") %></td>
				<td class="title_center"><%= label.getLabelName("L_InitInv") %></td>
				<td class="title_center"><%= label.getLabelName("L_ProdCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_ProdName") %></td>
				<td class="title_center"><%= label.getLabelName("L_DataCollectionInterval") %></td>
				<td class="title_center"><%= label.getLabelName("L_PurchaseData") %></td>
				<td class="title_center"><%= label.getLabelName("L_PurchasingDataByTime") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesData") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesDataByTime") %></td>
				<td class="title_center"><%= label.getLabelName("L_StockData") %></td>
				<td class="title_center"><%= label.getLabelName("L_InventoryDataByTime") %></td>
			</tr>
			<%
             int i = 0;
             String strClassType = new String(); 
         
          %>
			<logic:iterate id="summary" collection="<%= searchresults %>">
				<%
            HashMap summaryMap = (HashMap)pageContext.getAttribute("summary");
            if(summaryMap == null) summaryMap = new HashMap();
            
            if(i%2 == 1){
              strClassType = "td-listrom";             
            }else{                    
              strClassType = "";
            }
              
            i++;     
          %>
				<tr onmouseover="this.className='tr-over'"
					onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"
					class="<%=JspHelper.filterNull(strClassType)%>">
					<td class="title_center"><custom:write property="regionname" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="cityname" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="area1name" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="parentemployeename" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="salesrepname" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="orgcode" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="orgname" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="orgattributes1" name="summary" dictType="DealersLevel" nbsp="true"/></td>
					<td class="title_center"><custom:write property="ischain" name="summary" nbsp="true" dictType="YesOrNo"/></td>
					<td class="title_center"><custom:write property="islocked" name="summary" nbsp="true" dictType="YesOrNo" /></td>
                   
					<td class="title_center"><custom:write property="istarget" name="summary" nbsp="true" dictType="YesOrNo"/></td>
					<td class="title_center"><custom:write property="openinventory" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="itemcode" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="itemname" name="summary" nbsp="true" /></td>
					<td class="title_center"><custom:write property="filedate" name="summary" nbsp="true" dataType="date" dataFormat="yyyy-MM-dd"/></td>
					<td class="title_center">
					<%if(privilegeSet != null && privilegeSet.contains("MB-SPI04")){%>
					<a onclick="page_info('<custom:write property="orgid" name="summary"  />','<custom:write property="itemid" name="summary" />','<custom:write property="filedate" name="summary" />','<custom:write property="area1code" name="summary"  />','pur')"><custom:write property="pqty" name="summary" nbsp="true" /></a>
					<%}else{%>
					<custom:write property="pqty" name="summary" nbsp="true" />
					<%}%>
					</td>
					<td class="title_center"><custom:write property="purchasedate" name="summary" nbsp="true" dataType="date" dataFormat="yyyy-MM-dd"/></td>
					<td class="title_center">
					<%if(privilegeSet != null && privilegeSet.contains("MB-SPI05")){%>
					<a onclick="page_info('<custom:write property="orgid" name="summary" />','<custom:write property="itemid" name="summary"  />','<custom:write property="filedate" name="summary" />','<custom:write property="area1code" name="summary"  />','sal')"><custom:write property="sqty" name="summary" nbsp="true" /></a>
					<%}else{%>
					<custom:write property="sqty" name="summary" nbsp="true" />
					<%}%>
					</td>
					<td class="title_center"><custom:write property="salsedate"  name="summary" nbsp="true" dataType="date" dataFormat="yyyy-MM-dd"/></td>
					<td class="title_center">
					<%if(privilegeSet != null && privilegeSet.contains("MB-SPI06")){%>
					<a onclick="page_info('<custom:write property="orgid" name="summary" />','<custom:write property="itemid" name="summary" />','<custom:write property="filedate" name="summary" />','<custom:write property="area1code" name="summary"  />','inv')"><custom:write property="iqty" name="summary" nbsp="true" /></a>
					<%}else{%>
					<custom:write property="iqty" name="summary" nbsp="true" />
					<%}%>
					</td>
					<td class="title_center"><custom:write property="inventorydate" name="summary" nbsp="true" dataType="date" dataFormat="yyyy-MM-dd"/></td>
				</tr>
			</logic:iterate>
				<% //--------------------------------------  flipping page --%>
			<tr>
				<%@ include file="/inc/SummaryAction.inc"%>
			</tr>
		</table>
   </div> 
   <!--  
           <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
                   <td class="td_center">
              	<% if(pageContext.getAttribute("searchresults")!=null){%>
              	<a onclick="page_excel();"><custom:button type="1" label="L_ExcelE" imgsrc="Modify.gif" border="0" style="width:100"/></a>&nbsp;&nbsp;<a onclick="page_actionfun();"><custom:button type="1" label="L_CheckPass" imgsrc="Modify.gif" border="0" style="width:100"/></a>
            <%} %>
              </td>
            </tr>
          </table>
   -->
    </td>
  </tr>
 </table>
</form>
<script>
for(i=0;i<cform.historyofmonthsalesid.length;i++){
	if(eval('cform.status'+i).value == "41"){
		cform.historyofmonthsalesid[i].disabled=true;
	}
}
</script>
</body>
</html>